<?php

namespace Acme\CommonBundle\Entity;

use Doctrine\ORM\Mapping as ORM;
use Doctrine\Common\Collections\ArrayCollection;

/**
 * Acme\CommonBundle\Entity\ConstUniversity
 *
 * @ORM\Table(name="const_university")
 * @ORM\Entity(repositoryClass="Acme\CommonBundle\Repository\UniversityRepository")
 */
class ConstUniversity
{
    /**
     * @var integer $id
     *
     * @ORM\Column(name="id", type="integer", nullable=false)
     * @ORM\Id
     * @ORM\GeneratedValue(strategy="IDENTITY")
     */
    private $id;

    /**
     * @var string $name
     *
     * @ORM\Column(name="name", type="string", length=255, nullable=true)
     */
    private $name;

    /**
     * @var integer $area
     *
     * @ORM\Column(name="area", type="integer", nullable=true)
     */
    private $area;
    
    /**
     * @var string $flag
     *
     * @ORM\Column(name="flag", type="string", length=1, nullable=true)
     */
    private $flag;

    /**
     * Inverse Side
     * @ORM\OneToMany(targetEntity="\Acme\UserBundle\Entity\CmUserInfo", mappedBy="universityInfo")
     */
    protected $users;
    
    public function __construct()
    {
    	$this->users = new ArrayCollection();
    }
    
    /**
     * Owning Side
     * @ORM\ManyToOne(targetEntity="\Acme\CommonBundle\Entity\ConstArea", inversedBy="universities")
     * @ORM\JoinColumn(name="area", referencedColumnName="id")
     */
    protected $areaInfo;


    /**
     * Get id
     *
     * @return integer 
     */
    public function getId()
    {
        return $this->id;
    }

    /**
     * Set name
     *
     * @param string $name
     */
    public function setName($name)
    {
        $this->name = $name;
    }

    /**
     * Get name
     *
     * @return string 
     */
    public function getName()
    {
        return $this->name;
    }

    /**
     * Set area
     *
     * @param integer $area
     */
    public function setArea($area)
    {
        $this->area = $area;
    }

    /**
     * Get area
     *
     * @return integer 
     */
    public function getArea()
    {
        return $this->area;
    }
    
    /**
     * Set flag
     *
     * @param string $flag
     * 
     * @ORM\prePersist
     */
    public function setFlag($flag = 0)
    {
    	$this->flag = $flag;
    }
    
    /**
     * Get flag
     *
     * @return string
     */
    public function getFlag()
    {
    	return $this->flag;
    }

    /**
     * Add users
     *
     * @param Acme\UserBundle\Entity\CmUserInfo $users
     */
    public function addCmUserInfo(\Acme\UserBundle\Entity\CmUserInfo $users)
    {
        $this->users[] = $users;
    }

    /**
     * Get users
     *
     * @return Doctrine\Common\Collections\Collection 
     */
    public function getUsers()
    {
        return $this->users;
    }

    /**
     * Set areaInfo
     *
     * @param Acme\CommonBundle\Entity\ConstArea $areaInfo
     */
    public function setAreaInfo(\Acme\CommonBundle\Entity\ConstArea $areaInfo)
    {
        $this->areaInfo = $areaInfo;
    }

    /**
     * Get areaInfo
     *
     * @return Acme\CommonBundle\Entity\ConstArea 
     */
    public function getAreaInfo()
    {
        return $this->areaInfo;
    }
}